<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${article.title}">文章详情</title>
    <link rel="stylesheet" href="/css/style.css">
    <style>
        .article-detail {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        .article-header {
            border-bottom: 1px solid #eee;
            padding-bottom: 20px;
            margin-bottom: 20px;
        }
        .article-title {
            font-size: 28px;
            font-weight: bold;
            color: #333;
            margin-bottom: 10px;
        }
        .article-meta {
            color: #666;
            font-size: 14px;
            display: flex;
            gap: 20px;
            align-items: center;
        }
        .article-content {
            line-height: 1.8;
            font-size: 16px;
            color: #333;
            margin-bottom: 30px;
        }
        .article-actions {
            display: flex;
            gap: 10px;
            padding: 20px 0;
            border-top: 1px solid #eee;
        }
        .btn {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
        }
        .btn-primary {
            background: #007bff;
            color: white;
        }
        .btn-secondary {
            background: #6c757d;
            color: white;
        }
        .btn:hover {
            opacity: 0.8;
        }
        .back-link {
            display: inline-block;
            margin-bottom: 20px;
            color: #007bff;
            text-decoration: none;
        }
        .back-link:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div th:replace="~{fragments/header :: header}"></div>
    
    <main class="main-content">
        <div class="container">
            <a href="/articles" class="back-link">← 返回文章列表</a>
            
            <div class="article-detail">
                <div class="article-header">
                    <h1 class="article-title" th:text="${article.title}">文章标题</h1>
                    <div class="article-meta">
                        <span>作者：<span th:text="${article.author.nickname != null ? article.author.nickname : article.author.username}">作者名</span></span>
                        <span>发布时间：<span th:text="${#temporals.format(article.publishedDate, 'yyyy-MM-dd HH:mm')}">发布时间</span></span>
                        <span>分类：<span th:text="${article.category.name}">分类</span></span>
                        <span>阅读量：<span th:text="${article.viewCount}">0</span></span>
                    </div>
                </div>
                
                <div class="article-content" th:utext="${article.content}">
                    文章内容
                </div>
                
                <div class="article-actions" th:if="${#authentication.name == article.author.username}">
                    <a th:href="@{/articles/{id}/edit(id=${article.id})}" class="btn btn-primary">编辑文章</a>
                    <a th:href="@{/articles/{id}/delete(id=${article.id})}" class="btn btn-secondary" 
                       onclick="return confirm('确定要删除这篇文章吗？')">删除文章</a>
                </div>
            </div>
        </div>
    </main>
    
    <div th:replace="~{fragments/footer :: footer}"></div>
</body>
</html>